﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HRM.Entity;

namespace HRM.DAL
{
    public class EmployeeContractDAL: BaseDAL
    {
        public List<EmployeeContract> GetAllByEmpID(int empID)
        {
            var query = from empContract in Repository.All<EmployeeContract>()
                        where empContract.EmpID == empID
                        select empContract;
            return query.ToList();                        
        }

        public EmployeeContract GetByID(int ID)
        {
            return Repository.Single<EmployeeContract>(ec => ec.ID == ID);
        }

        public EmployeeContract Update(EmployeeContract item)
        {
            Repository.Update<EmployeeContract>(item);
            return item;
        }

        public void Delete(int ID)
        {
            Repository.Delete<EmployeeContract>(ID);
        }

        public EmployeeContract Add(EmployeeContract item)
        {
            Repository.Add<EmployeeContract>(item);
            return item;
        }
    }
}
